package com.eraasoftware.npa.client;

import java.util.ArrayList;

/**
 * Request header, this class is sent to the client.
 * 
 * @author eddie
 * 
 */
public class Header {
	ActionEnum action = ActionEnum.NATIVE;

	public static enum ActionEnum {
		NATIVE, PING, NEW_CLIENT
	}

	private String actionHandler;

	String function;

	java.util.Collection<Parameter> parameters;

	public void setAction(ActionEnum action) {
		this.action = action;
	}

	public ActionEnum getAction() {
		return action;
	}

	public void setFunction(String function) {
		this.function = function;
	}

	public String getFunction() {
		return function;
	}

	public java.util.Collection<Parameter> getParameters() {
		return parameters;
	}

	public void addParameter(String name, String value) {
		if (parameters == null) {
			parameters = new ArrayList<Parameter>();
		}
		parameters.add(new Parameter(name, value));

	}

	public void setActionHandler(Class<? extends ActionHandler> handlerClass) {
		this.actionHandler = handlerClass.getName();
	}

	public String getActionHandler() {
		return actionHandler;
	}

	public void setActionHandler(String actionHandler) {
		this.actionHandler = actionHandler;
	}
}
